package io.github.handyang.algorithms.sort;

public class BubbleSortAlgorithms implements SortAlgorithms {
    @Override
    public void sort(int[] arr) {
        if (arr == null || arr.length < 2) return;

        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j + 1 < arr.length; j++) {
                if (less(arr[j + 1], arr[j])) swap(arr, j, j + 1);
            }
        }
    }
}
